﻿using stdCall.MyRandom;
using stdCall.Resource;
using stdCall.TotalService;
using stdCall;
using System.Windows.Forms;
using stdCall.MyUtils;

namespace stdCall.MyEvaluation
{
    /// <summary>
    /// 继承ResourceGet，提供评价模块的服务
    /// </summary>
    class EvaluateService:ResourceGet
    {
        Evaluation evaluation = new Evaluation();

        /// <summary>
        /// 评价主函数
        /// 点击星星触发
        /// 因为逻辑和第一次不同，判断是否已做了第一次随机，没有不继续
        /// 添加当前学生到历史记录
        /// 改变RandomService.currentStudent=RandomService.nextStudent;
        /// 延迟，让星星保留一段时间
        /// </summary>
        /// <param name="sender">点击的星星</param>
        public void evaluateCurrentStd(object sender){
            if (RandomService.nextStudent == null || RandomService.currentStudent == null)
            {
                return;
            }
            Panel panel_history = (Panel)resources["panel_history"];
            evaluation.markStarAndAddHisLabel((PictureBox)sender, RandomService.currentStudent, panel_history.Controls);
            Utils.Delay(500);
            FormMain.clearStars();
            Service.getAnimateService().animateCurrentStd(RandomService.nextStudent, 1);
            RandomService.currentStudent = RandomService.nextStudent;
            RandomService.nextStudent=Service.getAnimateService().animateNextAndReturnStd();
            //Utils.Delay(100);
        }
    }
}
